#include <opencv/cv.h>
#include <opencv/highgui.h>
#include "PeopleDetector.h"
#include "ImageProcessor.h"
#include "Person.h"
#include "GestureDetector.h"
#include <sstream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <list>
#include <sstream>


/**
* @class KinectInteraction
*
* @brief Connects Kinect device and processing classes.
*
*
* This class contains functions for retrieving Kinect data,
* processing it and displaying results as images or text.
*
* @author Elisabeth Lindquist, elisabeth.lindquist@gmail.com
*
*/

using namespace cv;



class KinectInteraction{
    public:
        KinectInteraction();
        ~KinectInteraction();

        void init();
        void run(int idx);
        void draw();
        void record();
        void train();
        void record(Mat &pro);
        void detect();
        void stop();

    private:
        ImageProcessor *imgProc;
        PeopleDetector *detector;
        GestureDetector *gesture;

        list<Point3i> handPosList;
        list<float> handHeadRatioList;
        list<Point3i> centrePosList;

        //Configuration
        string currentGesture;
        int near, far, samples;
        float min_ratio, max_ratio;

        vector<Mat> prototypes;
        vector<String> gestureNames;


        vector<Person> currentPeople;
        vector<Person> foundPeople;
        vector<Mat> channels;


        float calcSpeed();
        void setGesture(int idx);

        bool running;
        bool readConfig();

        Mat rgb, gray, depth, depthScaled, mask;







};
